EXPORT_FILE_TYPE=data

startYear=1994
endYear=2008

filename[0]=pkugsm20081016094102.txt
filename[1]=pkugsm20081016094511.txt
filename[2]=pkugsm20081016095352.txt
filename[3]=pkugsm20081016095708.txt
filename[4]=pkugsm20081016100129.txt
filename[5]=pkugsm20081016100814.txt
i=0
while [ $i -le 5 ]
do
	echo ${filename[i]} is processing...
	j=$startYear
	while [ $j -le $endYear ]
	do
	echo $j
##############	
		echo "BEGIN {
	FS=\"\\t\"
}
\$1 ~ /$j[0-9][0-9][0-9][0-9]/ {
	print
}
" > extract_daily_price.awk
##############
		
		awk -f extract_daily_price.awk ${filename[i]} >> $j.${EXPORT_FILE_TYPE} 
		j=$((j+1))
	done
	i=$((i+1))
done